export default {
  column: [{
    label: '个人信息',
    prop: 'info',
    option: {
      submitText: '修改',
      column: [
      //   {
      //   label: '头像',
      //   type: 'upload',
      //   listType: 'picture-img',
      //   propsHttp: {
      //      res: 'data'
      //   },
      //   canvasOption: {
      //     text: 'blade',
      //     ratio: 0.1
      //   },
      //   action: '/api/xmbz-goods/file/upload',
      //   tip: '只能上传jpg/png用户头像，且不超过500kb',
      //   span: 12,
      //   row: true,
      //   prop: 'avatar'
      // }, 
      {
        label: '姓名',
        span: 12,
        row: true,
        prop: 'name'
      }, {
        label: '用户名',
        span: 12,
        row: true,
        prop: 'realName'
      }, {
        label: '手机号',
        span: 12,
        row: true,
        prop: 'phone'
      }, {
        label: '邮箱',
        prop: 'email',
        span: 12,
        row: true,
      }]
    }
  }, {
    label: '修改密码',
    prop: 'password',
    option: {
      submitText: '修改',
      column: [{
        label: '原密码',
        span: 12,
        row: true,
        type: 'password',
        prop: 'oldPassword',
        rules: [{
          required: true,
          message: '请输入原密码',
          trigger: 'change'
        }]
      }, {
        label: '新密码',
        span: 12,
        row: true,
        type: 'password',
        prop: 'newPassword',
        rules: [{
          required: true,
          validator: (rule, value, callback) => {
            if (value === '' || value === undefined) {
              callback(new Error('请输入新密码'));
            } else if(value.length < 8 || value.length > 16) {
              callback(new Error('新密码长度为8~16'));
            } else if((/[0-9]/).test(value) && (/[a-zA-Z]/).test(value)) {
              callback();
            } else {
              callback(new Error('新密码必须含有数字和英文'));
            }
          },
          trigger: 'change'
        }]
      }, {
        label: '确认密码',
        span: 12,
        row: true,
        type: 'password',
        prop: 'newPassword1',
        rules: [{
          required: true,
          validator: (rule, value, callback) => {
            // console.log('validator',window.newPassword());
            if (value === '' || value === undefined) {
              callback(new Error('请确认密码'));
            } else if(value !== window.newPassword()) {
              callback(new Error('两次输入密码不一致!'));
            } else {
              callback();
            }
          },
          trigger: 'change'
        }]
      }]
    }
  }]
}
